package com.itheima.hmshopping.app.controller;

import com.itheima.hmshopping.app.service.OmsOrderService;
import com.itheima.hmshopping.dto.OrderListDto;
import com.itheima.hmshopping.entity.OmsOrder;
import com.itheima.hmshopping.util.HmPage;
import com.itheima.hmshopping.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("order")
public class OmsOrderController {
    @Autowired
    private OmsOrderService omsOrderService;

    /**
     * 查询订单
     * @return
     */
    @GetMapping("list")
    public R<HmPage<OmsOrder>> getOrderList(@RequestBody OrderListDto orderListDto){
        return omsOrderService.getOrderList(orderListDto);
    }

    /**
     * 批量删除订单
     * @return
     */
    @PostMapping("delete")
    public R<String> deleteOrderByIds(Integer[] ids){
        return omsOrderService.deleteOrderByIds(ids);
    }

    /**
     * 批量关闭订单
     * @param params
     */
    @PostMapping("close")
    public R<String> closeOrderByIds(@RequestParam Map<String,Object> params){
        return omsOrderService.closeOrderByIds(params);
    }
}
